package map;

import java.util.HashMap;
import java.util.Map;

public class MapDemo {
    public static void main(String[] args) {

        Map<String,Integer> map = new HashMap<>();
        Integer value = map.put("语文",98);
        System.out.println(value);
        map.put("语文",98);
        map.put("数学",97);
        map.put("英语",98);
        map.put("物理",96);
        map.put("化学",94);
        System.out.println(map);
        value = map.put("语文",55);
        System.out.println(map);
        System.out.println(value);

        int size = map.size();
        System.out.println("size:" + size);

        value = map.get("英语");
        System.out.println("英语:" + value);
        value = map.get("体育");
        System.out.println("体育:" + value);

        value = map.remove("语文");
        System.out.println(map);
        System.out.println(value);

        boolean ck = map.containsKey("体育");
        boolean cv = map.containsValue(97);
        System.out.println("包含key:" + ck);
        System.out.println("包含value:" + cv);

        map.clear();
        System.out.println(map);
    }
}
